import Data.List(transpose,group)
import IO(stdin,hGetContents)

f (_:_:rows) = sum:parts where
 sum   = "Total Walk Distance = " ++ show (length ways)
 parts = map count $ group $ ways
 ways  = map (head . filter (/= ' ')) $ transpose rows
 count s@(ch:_) = way ch ++ " " ++ show (length s) ++ " steps"
 way '/'  = "Up"
 way '\\' = "Down"
 way '_'  = "Walk"

rowList f = unlines . f . lines

main = do
 rows <- hGetContents stdin
 putStr $ rowList f rows
